from header_common import *
from header_parties import *
from ID_troops import *
from ID_factions import *
from ID_map_icons import *

pmf_is_prisoner = 0x0001

####################################################################################################################
#  Each party template record contains the following fields:
#  1) Party-template id: used for referencing party-templates in other files.
#     The prefix pt_ is automatically added before each party-template id.
#  2) Party-template name.
#  3) Party flags. See header_parties.py for a list of available flags
#  4) Menu. ID of the menu to use when this party is met. The value 0 uses the default party encounter system.
#  5) Faction
#  6) Personality. See header_parties.py for an explanation of personality flags.
#  7) List of stacks. Each stack record is a tuple that contains the following fields:
#    7.1) Troop-id. 
#    7.2) Minimum number of troops in the stack. 
#    7.3) Maximum number of troops in the stack. 
#    7.4) Member flags(optional). Use pmf_is_prisoner to note that this member is a prisoner.
#     Note: There can be at most 6 stacks.
####################################################################################################################


party_templates = [
  ("none","none",icon_gray_knight|pf_auto_start_dialog,0,fac_commoners,merchant_personality,[]),
  ("rescued_prisoners","Rescued Prisoners",icon_gray_knight|pf_auto_start_dialog,0,fac_commoners,merchant_personality,[]),
  ("enemy","Enemy",icon_gray_knight|pf_auto_start_dialog,0,fac_undeads,merchant_personality,[]),
  ("hero_party","Hero Party",icon_gray_knight|pf_auto_start_dialog,0,fac_commoners,merchant_personality,[]),
####################################################################################################################
# Party templates before this point are hard-wired into the game and should not be changed. 
####################################################################################################################
  ("vaegir_nobleman","Vaegir Nobleman",icon_vaegir_knight|carries_goods(10)|pf_quest_party|pf_auto_start_dialog,0,fac_commoners,merchant_personality,[(trp_nobleman,1,1),(trp_vaegir_knight,2,6),(trp_vaegir_horseman,4,12)]),
  ("swadian_nobleman","Swadian Nobleman",icon_gray_knight|carries_goods(10)|pf_quest_party|pf_auto_start_dialog,0,fac_commoners,merchant_personality,[(trp_nobleman,1,1),(trp_swadian_knight,2,6),(trp_swadian_man_at_arms,4,12)]),
  ("river_pirates","River Pirates",icon_axeman|carries_goods(1)|pf_auto_start_dialog,0,fac_outlaws,bandit_personality,[(trp_river_pirate,3,30)]),
  ("manhunters","Manhunters",icon_gray_knight|pf_auto_start_dialog,0,fac_manhunters,soldier_personality,[(trp_manhunter,9,40)]),
  ("peasant","Peasant",icon_peasant|pf_auto_start_dialog,0,fac_commoners,merchant_personality,[(trp_farmer,1,6),(trp_peasant_woman,0,7)]),

  ("black_khergit_raiders","Black Khergit Raiders",icon_khergit|carries_goods(2)|pf_auto_start_dialog,0,fac_black_khergits,bandit_personality,[(trp_black_khergit_guard,1,10),(trp_black_khergit_horseman,5,5)]),
  ("steppe_bandits","Steppe Bandits",icon_khergit|carries_goods(2)|pf_auto_start_dialog,0,fac_outlaws,bandit_personality,[(trp_steppe_bandit,6,58)]),
  ("forest_bandits","Forest Bandits",icon_axeman|carries_goods(2)|pf_auto_start_dialog,0,fac_forest_bandits,bandit_personality,[(trp_bandit,6,52)]),
  ("mountain_bandits","Mountain Bandits",icon_axeman|carries_goods(2)|pf_auto_start_dialog,0,fac_mountain_bandits,bandit_personality,[(trp_mountain_bandit,6,60)]),
  ("sea_raiders","Sea Raiders",icon_axeman|carries_goods(2)|pf_auto_start_dialog,0,fac_outlaws,bandit_personality,[(trp_sea_raider,6,50)]),

  ("merchant_caravan","Merchant Caravan",icon_gray_knight|carries_goods(20)|pf_auto_remove_in_town|pf_quest_party|pf_auto_start_dialog,0,fac_commoners,escorted_merchant_personality,[(trp_caravan_master,1,1),(trp_caravan_guard,12,40)]),
  ("troublesome_bandits","Troublesome Bandits",icon_axeman|carries_goods(9)|pf_quest_party|pf_auto_start_dialog,0,fac_outlaws,bandit_personality,[(trp_bandit,14,55)]),
  ("bandits_awaiting_ransom","Bandits Awaiting Ransom",icon_axeman|carries_goods(9)|pf_auto_remove_in_town|pf_quest_party|pf_auto_start_dialog,0,fac_neutral,bandit_personality,[(trp_bandit,24,58),(trp_kidnapped_girl,1,1,pmf_is_prisoner)]),
  ("kidnapped_girl","Kidnapped Girl",icon_woman|pf_quest_party|pf_auto_start_dialog,0,fac_neutral,merchant_personality,[(trp_kidnapped_girl,1,1)]),

  ("farmers","Farmers",icon_peasant|pf_auto_start_dialog,0,fac_innocents,merchant_personality,[(trp_farmer,11,22),(trp_peasant_woman,16,44)]),
  ("refugees","Refugees",icon_woman|pf_auto_start_dialog,0,fac_innocents,merchant_personality,[(trp_refugee,19,48)]),
  ("dark_hunters","Dark Hunters",icon_gray_knight|pf_auto_start_dialog,0,fac_dark_knights,soldier_personality,[(trp_dark_knight,4,42),(trp_dark_hunter,13,25)]),

  ("swadian_deserters","Swadian Deserters",icon_gray_knight|carries_goods(1)|pf_auto_start_dialog,0,fac_swadian_deserters,bandit_personality,[(trp_swadian_crossbowman,8,56)]),
  ("vaegir_deserters","Vaegir Deserters",icon_vaegir_knight|carries_goods(1)|pf_auto_start_dialog,0,fac_vaegir_deserters,bandit_personality,[(trp_vaegir_veteran,8,57)]),

# Caravans

  ("swadian_caravan","Swadian Caravan",icon_mule|carries_goods(25)|pf_auto_start_dialog,0,fac_swadian_caravans,merchant_personality,[(trp_caravan_master,1,1),(trp_swadian_knight,0,3),(trp_swadian_man_at_arms,3,30),(trp_swadian_crossbowman,5,14)]),
  ("vaegir_caravan","Vaegir Caravan",icon_mule|carries_goods(25)|pf_auto_start_dialog,0,fac_vaegir_caravans,merchant_personality,[(trp_caravan_master,1,1),(trp_vaegir_knight,0,3),(trp_vaegir_horseman,3,31),(trp_vaegir_veteran,5,14)]),

# Prisoner trains
  ("swadian_prisoner_train","Swadian Prisoner Train",icon_gray_knight|carries_goods(5)|pf_auto_start_dialog,0,fac_swadians,merchant_personality,[(trp_swadian_knight,2,8),(trp_swadian_man_at_arms,5,25),(trp_swadian_crossbowman,9,14),
                                                      (trp_vaegir_horseman,1,12,pmf_is_prisoner),(trp_vaegir_footman,6,10,pmf_is_prisoner),(trp_bandit,0,5,pmf_is_prisoner)]),
  ("vaegir_prisoner_train","Vaegir Prisoner Train",icon_vaegir_knight|carries_goods(5)|pf_auto_start_dialog,0,fac_vaegirs,merchant_personality,[(trp_vaegir_knight,2,8),(trp_vaegir_horseman,5,25),(trp_vaegir_veteran,9,14),
                                                      (trp_swadian_man_at_arms,1,12,pmf_is_prisoner),(trp_swadian_crossbowman,6,10,pmf_is_prisoner),(trp_bandit,0,5,pmf_is_prisoner)]),
# Foragers

  ("swadian_foragers","Swadian Foragers",icon_gray_knight|carries_goods(5)|pf_auto_start_dialog|pf_show_faction,0,fac_swadians,soldier_personality,[(trp_swadian_crossbowman,1,10),(trp_swadian_militia,3,16),(trp_swadian_peasant,9,24)]),
  ("vaegir_foragers","Vaegir Foragers",icon_vaegir_knight|carries_goods(5)|pf_auto_start_dialog,0,fac_vaegirs,merchant_personality,[(trp_vaegir_veteran,1,10),(trp_vaegir_footman,3,16),(trp_vaegir_peasant,9,24)]),

# Scouts

  ("swadian_scouts","Swadian Scouts",icon_gray_knight|carries_goods(1)|pf_auto_start_dialog,0,fac_swadians,soldier_personality,[(trp_swadian_knight,2,14),(trp_swadian_man_at_arms,4,20)]),
  ("vaegir_scouts","Vaegir Scouts",icon_vaegir_knight|carries_goods(1)|pf_auto_start_dialog,0,fac_vaegirs,soldier_personality,[(trp_vaegir_knight,1,14),(trp_vaegir_horseman,4,20)]),

# Patrols

  ("swadian_patrol","Swadian Patrol",icon_gray_knight|carries_goods(3)|pf_auto_start_dialog,0,fac_swadians,soldier_personality,[(trp_swadian_knight,2,20),(trp_swadian_man_at_arms,6,20),(trp_swadian_footman,5,20),(trp_swadian_crossbowman,5,10),(trp_swadian_militia,8,20)]),
  ("vaegir_patrol","Vaegir Patrol",icon_vaegir_knight|carries_goods(2)|pf_auto_start_dialog,0,fac_vaegirs,soldier_personality,[(trp_vaegir_knight,2,20),(trp_vaegir_horseman,6,20),(trp_vaegir_veteran,6,20),(trp_vaegir_archer,5,10),(trp_vaegir_footman,9,20)]),

# War Parties
  ("swadian_war_party","Swadian War Party",icon_gray_knight|carries_goods(5)|pf_auto_start_dialog,0,fac_swadians,soldier_personality,[(trp_swadian_knight,3,30),(trp_swadian_man_at_arms,10,30),(trp_swadian_footman,15,30),(trp_swadian_militia,15,30)]),
  ("vaegir_war_party","Vaegir War Party",icon_vaegir_knight|carries_goods(5)|pf_auto_start_dialog,0,fac_vaegirs,soldier_personality,[(trp_vaegir_knight,3,30),(trp_vaegir_horseman,10,30),(trp_vaegir_veteran,15,30),(trp_vaegir_footman,15,30)]),

# Raiders

  ("swadian_raiders","Swadian Raiders",icon_gray_knight|carries_goods(16)|pf_quest_party|pf_auto_start_dialog,0,fac_swadians,soldier_personality,[(trp_swadian_knight,1,15),(trp_swadian_man_at_arms,3,20),(trp_swadian_crossbowman,3,15),(trp_peasant_woman,6,30,pmf_is_prisoner)]),
  ("vaegir_raiders","Vaegir Raiders",icon_vaegir_knight|carries_goods(16)|pf_quest_party|pf_auto_start_dialog,0,fac_vaegirs,soldier_personality,[(trp_vaegir_knight,1,15),(trp_vaegir_horseman,3,20),(trp_vaegir_veteran,3,15),(trp_peasant_woman,6,30,pmf_is_prisoner)]),

]
